/**
 * Created By xiyuan
 * Author server@xiyuan.name (惜缘叛逆)
 * DateTime 2020/9/1 11:53 AM
 * Describe javascript功能描述
 * MIT License http://www.opensource.org/licenses/mit-license.php
 */
/*

export function docxGen(outFile) {
	
	const officegen = require('officegen');
	const fs = require('fs');
	const docx = officegen('docx');
	
	// 生成docx文档成功的监听
	docx.on('finalize', function (written) {
		console.log('文档生成完毕')
	})
	
	// 文档生成错误的监听
	docx.on('error', function (err) {
		console.log(err)
	})
	
	// 创建header
	const header = docx.getHeader().createP({align: ('center')});
	
	console.log(__dirname);
	
	header.addText('dominos代码采样', {font_size: 8, font_face: 'SimSun'});
	// 添加底线
	header.addHorizontalLine();
	
	// 创建文档段落
	let pObj = docx.createP();
	// 设置内容居中
	pObj.options.align = 'center';
	// 设置段落
	pObj.addText("前20页", {font_size: 20, font_face: 'KaiTi_GB2312'});
	
	
	// Create a new paragraph:
	pObj = docx.createP()
	
	pObj.addText('Simple')
	pObj.addText(' with color', {color: '000088'})
	pObj.addText(' and back color.', {color: '00ffff', back: '000088'})
	
	pObj = docx.createP()
	
	pObj.addText('Since ')
	pObj.addText('officegen 0.2.12', {
		back: '00ffff',
		shdType: 'pct12',
		shdColor: 'ff0000'
	}) // Use pattern in the background.
	pObj.addText(' you can do ')
	pObj.addText('more cool ', {highlight: true}) // Highlight!
	pObj.addText('stuff!', {highlight: 'darkGreen'}) // Different highlight color.
	
	pObj = docx.createP()
	
	pObj.addText('Even add ')
	pObj.addText('external link', {link: 'https://github.com'})
	pObj.addText('!')
	
	pObj = docx.createP()
	
	pObj.addText('Bold + underline', {bold: true, underline: true})
	
	pObj = docx.createP({align: 'center'})
	
	pObj.addText('Center this text', {
		border: 'dotted',
		borderSize: 12,
		borderColor: '88CCFF'
	})
	
	pObj = docx.createP()
	pObj.options.align = 'right'
	
	pObj.addText('Align this text to the right.')
	
	pObj = docx.createP()
	
	pObj.addText('Those two lines are in the same paragraph,')
	pObj.addLineBreak()
	pObj.addText('but they are separated by a line break.')
	
	docx.putPageBreak()
	
	pObj = docx.createP()
	
	pObj.addText('Fonts face only.', {font_face: 'Arial'})
	pObj.addText(' Fonts face and size.', {font_face: 'Arial', font_size: 40})
	
	docx.putPageBreak()
	
	// Let's generate the Word document into a file:'example.docx'
	
	
	
	return {
		add(text, option = {}) {
			pObj = docx.createP()
			pObj.addText(text)
		},
		// 生成
		generate() {
			
			let out = fs.createWriteStream('example.docx' || outFile);
			
			out.on('error', function (err) {
				console.log(err)
			})
			// Async call to generate the output file:
			docx.generate(out)
		}
	}
}*/
